home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 223_01 / ualloc.c < prev    next >
Text File  |  1980-01-01  |  768b  |  28 lines

  1.  
  2. /*
  3. ** ------------ Memory Allocation
  4. */
  5.  
  6. /*
  7. ** Allocate n bytes of (possibly zeroed) memory.
  8. ** Entry: n = Size of the items in bytes.
  9. **    clear = "true" if clearing is desired.
  10. ** Returns the address of the allocated block of memory
  11. ** or NULL if the requested amount of space is not available.
  12. */
  13.  
  14. #include <stdio.h>
  15.  
  16. extern char *zzmem;
  17.   static char *oldptr;
  18.  
  19. Ualloc(n, clear) char *n; int clear; {
  20.   if(n < avail(YES)) {
  21.     if(clear) pad(zzmem, NULL, n);
  22.     oldptr = zzmem;
  23.     zzmem += n;
  24.     return (oldptr);
  25.     }
  26.   return (NULL);
  27.   }
  28.